package com.storage.configuration;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Data
@Component
@ConfigurationProperties(prefix = "spring.storage")
public class StorageConfiguration {

    /**
     * 默认存储平台
     */
    private String defaultClient = "local";

    /**
     * 本地存储
     */
    private List<Local> local = new ArrayList<>();
    /**
     * 阿里云 OSS
     */
    private List<AliyunOss> aliyunOss = new ArrayList<>();

    /**
     * 本地存储
     */
    @Data
    public static class Client {
        /**
         * 是否启用存储
         */
        private Boolean enable = false;
        /**
         * 客户端名称
          */
        private String client = "";
    }

    /**
     * 本地存储
     */
    @Data
    public static class Local extends Client{

    }

    /**
     * 阿里云 OSS
     */
    @Data
    public static class AliyunOss extends Client{
        private String accessKey;
        private String secretKey;
        private String endPoint;
        private String bucketName;
    }

}
